<?php

namespace App\Admin\Controllers;

use App\Models\Tag;
use Encore\Admin\Controllers\AdminController as Controller;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;

class TagController extends Controller
{
    protected $title = "标签管理";

    protected function grid()
    {
        $grid = new Grid(new Tag);

        $grid->id('ID');
        $grid->name('名称');
        $grid->created_at('创建时间');
        $grid->updated_at('更新时间');

        return $grid;
    }

    protected function detail($id)
    {
        $show = new Show(Tag::findOrFail($id));

        $show->id('ID');
        $show->name('名称');
        $show->created_at('创建时间');
        $show->updated_at('更新时间');

        return $show;
    }

    protected function form()
    {
        $form = new Form(new Tag);

        $form->text('name', '名称');

        return $form;
    }
}
